package online.longzipeng.back.controller;

import online.longzipeng.back.pojo.Result;
import online.longzipeng.back.pojo.entity.BillType;
import online.longzipeng.back.pojo.param.BillTypeQueryParam;
import online.longzipeng.back.pojo.vo.BillTypeVo;
import online.longzipeng.back.service.BillTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lzp
 */
@RestController
@RequestMapping("/billType")
public class BillTypeController {

    @Autowired
    private BillTypeService billTypeService;

    /**
     * 保存或修改账单类型
     */
    @PostMapping("/save")
    public Result save(@RequestBody BillType billType) {
        billTypeService.save(billType);
        return Result.success();
    }

    /**
     * 查询账单类型列表
     */
    @PostMapping("/list")
    public Result<List<BillTypeVo>> list(@RequestBody BillTypeQueryParam param) {
        return Result.success(billTypeService.list(param));
    }


}
